<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>LogDevice API: /Users/chunma/fbsource/fbcode/logdevice/include/AsyncReader.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">LogDevice API
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_3c764b8ed47d00d6b5627c49bc32f70b.html">fbsource</a></li><li class="navelem"><a class="el" href="dir_7d108206b339ff559c2aaa41b8fb2672.html">fbcode</a></li><li class="navelem"><a class="el" href="dir_903050bd1b8bae4e85fca6c90c654c58.html">logdevice</a></li><li class="navelem"><a class="el" href="dir_46acbb48b960dc60b3c5450db912a0e4.html">include</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">AsyncReader.h</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;</div><div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="preprocessor">#pragma once</span></div><div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;</div><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="preprocessor">#include &lt;functional&gt;</span></div><div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="preprocessor">#include &lt;memory&gt;</span></div><div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;</div><div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="preprocessor">#include &quot;logdevice/include/Record.h&quot;</span></div><div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="preprocessor">#include &quot;logdevice/include/types.h&quot;</span></div><div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;</div><div class="line"><a name="l00017"></a><span class="lineno"><a class="line" href="namespacefacebook.html">   17</a></span>&#160;<span class="keyword">namespace </span><a class="code" href="namespacefacebook.html">facebook</a> { <span class="keyword">namespace </span>logdevice {</div><div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;</div><div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="keyword">struct </span>ReadStreamAttributes;</div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;</div><div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="keyword">enum class</span> HealthChangeType {</div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;  LOG_HEALTHY = 0,</div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;  LOG_UNHEALTHY = 1,</div><div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;};</div><div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;</div><div class="line"><a name="l00041"></a><span class="lineno"><a class="line" href="classfacebook_1_1logdevice_1_1_async_reader.html">   41</a></span>&#160;<span class="keyword">class </span><a class="code" href="classfacebook_1_1logdevice_1_1_async_reader.html">AsyncReader</a> {</div><div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160; <span class="keyword">public</span>:</div><div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span></div><div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;    <a class="code" href="classfacebook_1_1logdevice_1_1_async_reader.html#a5178eed40dc11734b248565c2009a06f">setRecordCallback</a>(std::function&lt;<span class="keywordtype">bool</span>(std::unique_ptr&lt;DataRecord&gt;&amp;)&gt;) = 0;</div><div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;</div><div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classfacebook_1_1logdevice_1_1_async_reader.html#a161d3d09e946c826c7797c25e4bc27a2">setGapCallback</a>(std::function&lt;<span class="keywordtype">bool</span>(<span class="keyword">const</span> GapRecord&amp;)&gt;) = 0;</div><div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;</div><div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classfacebook_1_1logdevice_1_1_async_reader.html#a437d725a72d1283d9be47cbb2e480183">setDoneCallback</a>(std::function&lt;<span class="keywordtype">void</span>(logid_t)&gt;) = 0;</div><div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;</div><div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span></div><div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;  <a class="code" href="classfacebook_1_1logdevice_1_1_async_reader.html#aac22c5e34091c1bfe6ceea1c24fde335">setHealthChangeCallback</a>(std::function&lt;<span class="keywordtype">void</span>(logid_t, HealthChangeType)&gt;) = 0;</div><div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;</div><div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="classfacebook_1_1logdevice_1_1_async_reader.html#a13331e00d2b9fd60c3d956927dd3cefc">startReading</a>(</div><div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;      logid_t log_id,</div><div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;      lsn_t from,</div><div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;      lsn_t until = LSN_MAX,</div><div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;      <span class="keyword">const</span> ReadStreamAttributes* attrs = <span class="keyword">nullptr</span>) = 0;</div><div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160;</div><div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="classfacebook_1_1logdevice_1_1_async_reader.html#a7e26fd1ce23777a8af17922a3005f1ef">stopReading</a>(logid_t log_id,</div><div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160;                          std::function&lt;<span class="keywordtype">void</span>()&gt; callback = <span class="keyword">nullptr</span>) = 0;</div><div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;</div><div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="classfacebook_1_1logdevice_1_1_async_reader.html#aed6742bbd7a2a61566d8a1deb44ff25f">resumeReading</a>(logid_t log_id) = 0;</div><div class="line"><a name="l00195"></a><span class="lineno">  195</span>&#160;</div><div class="line"><a name="l00204"></a><span class="lineno">  204</span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classfacebook_1_1logdevice_1_1_async_reader.html#a59b684294bf9b6c97ab26671a5bb3894">withoutPayload</a>() = 0;</div><div class="line"><a name="l00205"></a><span class="lineno">  205</span>&#160;</div><div class="line"><a name="l00215"></a><span class="lineno">  215</span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classfacebook_1_1logdevice_1_1_async_reader.html#ae12350808c55ead68ad150cd8c6bec59">forceNoSingleCopyDelivery</a>() = 0;</div><div class="line"><a name="l00216"></a><span class="lineno">  216</span>&#160;</div><div class="line"><a name="l00227"></a><span class="lineno">  227</span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classfacebook_1_1logdevice_1_1_async_reader.html#a1d29d960a147d0ccfef20edabf523a16">includeByteOffset</a>() = 0;</div><div class="line"><a name="l00228"></a><span class="lineno">  228</span>&#160;</div><div class="line"><a name="l00241"></a><span class="lineno">  241</span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classfacebook_1_1logdevice_1_1_async_reader.html#ad42800430d4e5c088b81c1c271857a95">doNotSkipPartiallyTrimmedSections</a>() = 0;</div><div class="line"><a name="l00242"></a><span class="lineno">  242</span>&#160;</div><div class="line"><a name="l00256"></a><span class="lineno">  256</span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="classfacebook_1_1logdevice_1_1_async_reader.html#a272afa75bca495b89dfd2cc5e400a4d1">isConnectionHealthy</a>(logid_t) <span class="keyword">const</span> = 0;</div><div class="line"><a name="l00257"></a><span class="lineno">  257</span>&#160;</div><div class="line"><a name="l00267"></a><span class="lineno">  267</span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classfacebook_1_1logdevice_1_1_async_reader.html#a8ccc11109a00b0806cc213567f37929c">doNotDecodeBufferedWrites</a>() = 0;</div><div class="line"><a name="l00268"></a><span class="lineno">  268</span>&#160;</div><div class="line"><a name="l00289"></a><span class="lineno">  289</span>&#160;  <span class="keyword">static</span> lsn_t <a class="code" href="classfacebook_1_1logdevice_1_1_async_reader.html#a5059c10f5e16a5c6dfb78c6b0a5d6733">nextFromLsnWhenStuck</a>(lsn_t stuck_lsn = LSN_INVALID,</div><div class="line"><a name="l00290"></a><span class="lineno">  290</span>&#160;                                    lsn_t tail_lsn = LSN_INVALID);</div><div class="line"><a name="l00291"></a><span class="lineno">  291</span>&#160;</div><div class="line"><a name="l00292"></a><span class="lineno">  292</span>&#160;  <span class="keyword">virtual</span> ~<a class="code" href="classfacebook_1_1logdevice_1_1_async_reader.html">AsyncReader</a>() { }</div><div class="line"><a name="l00293"></a><span class="lineno">  293</span>&#160;};</div><div class="line"><a name="l00294"></a><span class="lineno">  294</span>&#160;</div><div class="line"><a name="l00295"></a><span class="lineno">  295</span>&#160;}}</div><div class="ttc" id="classfacebook_1_1logdevice_1_1_async_reader_html_ad42800430d4e5c088b81c1c271857a95"><div class="ttname"><a href="classfacebook_1_1logdevice_1_1_async_reader.html#ad42800430d4e5c088b81c1c271857a95">facebook::logdevice::AsyncReader::doNotSkipPartiallyTrimmedSections</a></div><div class="ttdeci">virtual void doNotSkipPartiallyTrimmedSections()=0</div></div>
<div class="ttc" id="classfacebook_1_1logdevice_1_1_async_reader_html_a272afa75bca495b89dfd2cc5e400a4d1"><div class="ttname"><a href="classfacebook_1_1logdevice_1_1_async_reader.html#a272afa75bca495b89dfd2cc5e400a4d1">facebook::logdevice::AsyncReader::isConnectionHealthy</a></div><div class="ttdeci">virtual int isConnectionHealthy(logid_t) const =0</div></div>
<div class="ttc" id="classfacebook_1_1logdevice_1_1_async_reader_html_aac22c5e34091c1bfe6ceea1c24fde335"><div class="ttname"><a href="classfacebook_1_1logdevice_1_1_async_reader.html#aac22c5e34091c1bfe6ceea1c24fde335">facebook::logdevice::AsyncReader::setHealthChangeCallback</a></div><div class="ttdeci">virtual void setHealthChangeCallback(std::function&lt; void(logid_t, HealthChangeType)&gt;)=0</div></div>
<div class="ttc" id="classfacebook_1_1logdevice_1_1_async_reader_html_a437d725a72d1283d9be47cbb2e480183"><div class="ttname"><a href="classfacebook_1_1logdevice_1_1_async_reader.html#a437d725a72d1283d9be47cbb2e480183">facebook::logdevice::AsyncReader::setDoneCallback</a></div><div class="ttdeci">virtual void setDoneCallback(std::function&lt; void(logid_t)&gt;)=0</div></div>
<div class="ttc" id="classfacebook_1_1logdevice_1_1_async_reader_html_a7e26fd1ce23777a8af17922a3005f1ef"><div class="ttname"><a href="classfacebook_1_1logdevice_1_1_async_reader.html#a7e26fd1ce23777a8af17922a3005f1ef">facebook::logdevice::AsyncReader::stopReading</a></div><div class="ttdeci">virtual int stopReading(logid_t log_id, std::function&lt; void()&gt; callback=nullptr)=0</div></div>
<div class="ttc" id="classfacebook_1_1logdevice_1_1_async_reader_html_aed6742bbd7a2a61566d8a1deb44ff25f"><div class="ttname"><a href="classfacebook_1_1logdevice_1_1_async_reader.html#aed6742bbd7a2a61566d8a1deb44ff25f">facebook::logdevice::AsyncReader::resumeReading</a></div><div class="ttdeci">virtual int resumeReading(logid_t log_id)=0</div></div>
<div class="ttc" id="namespacefacebook_html"><div class="ttname"><a href="namespacefacebook.html">facebook</a></div><div class="ttdef"><b>Definition:</b> AsyncReader.h:17</div></div>
<div class="ttc" id="classfacebook_1_1logdevice_1_1_async_reader_html_a59b684294bf9b6c97ab26671a5bb3894"><div class="ttname"><a href="classfacebook_1_1logdevice_1_1_async_reader.html#a59b684294bf9b6c97ab26671a5bb3894">facebook::logdevice::AsyncReader::withoutPayload</a></div><div class="ttdeci">virtual void withoutPayload()=0</div></div>
<div class="ttc" id="classfacebook_1_1logdevice_1_1_async_reader_html_a8ccc11109a00b0806cc213567f37929c"><div class="ttname"><a href="classfacebook_1_1logdevice_1_1_async_reader.html#a8ccc11109a00b0806cc213567f37929c">facebook::logdevice::AsyncReader::doNotDecodeBufferedWrites</a></div><div class="ttdeci">virtual void doNotDecodeBufferedWrites()=0</div></div>
<div class="ttc" id="classfacebook_1_1logdevice_1_1_async_reader_html"><div class="ttname"><a href="classfacebook_1_1logdevice_1_1_async_reader.html">facebook::logdevice::AsyncReader</a></div><div class="ttdef"><b>Definition:</b> AsyncReader.h:41</div></div>
<div class="ttc" id="classfacebook_1_1logdevice_1_1_async_reader_html_a1d29d960a147d0ccfef20edabf523a16"><div class="ttname"><a href="classfacebook_1_1logdevice_1_1_async_reader.html#a1d29d960a147d0ccfef20edabf523a16">facebook::logdevice::AsyncReader::includeByteOffset</a></div><div class="ttdeci">virtual void includeByteOffset()=0</div></div>
<div class="ttc" id="classfacebook_1_1logdevice_1_1_async_reader_html_a5178eed40dc11734b248565c2009a06f"><div class="ttname"><a href="classfacebook_1_1logdevice_1_1_async_reader.html#a5178eed40dc11734b248565c2009a06f">facebook::logdevice::AsyncReader::setRecordCallback</a></div><div class="ttdeci">virtual void setRecordCallback(std::function&lt; bool(std::unique_ptr&lt; DataRecord &gt; &amp;)&gt;)=0</div></div>
<div class="ttc" id="classfacebook_1_1logdevice_1_1_async_reader_html_a5059c10f5e16a5c6dfb78c6b0a5d6733"><div class="ttname"><a href="classfacebook_1_1logdevice_1_1_async_reader.html#a5059c10f5e16a5c6dfb78c6b0a5d6733">facebook::logdevice::AsyncReader::nextFromLsnWhenStuck</a></div><div class="ttdeci">static lsn_t nextFromLsnWhenStuck(lsn_t stuck_lsn=LSN_INVALID, lsn_t tail_lsn=LSN_INVALID)</div></div>
<div class="ttc" id="classfacebook_1_1logdevice_1_1_async_reader_html_ae12350808c55ead68ad150cd8c6bec59"><div class="ttname"><a href="classfacebook_1_1logdevice_1_1_async_reader.html#ae12350808c55ead68ad150cd8c6bec59">facebook::logdevice::AsyncReader::forceNoSingleCopyDelivery</a></div><div class="ttdeci">virtual void forceNoSingleCopyDelivery()=0</div></div>
<div class="ttc" id="classfacebook_1_1logdevice_1_1_async_reader_html_a13331e00d2b9fd60c3d956927dd3cefc"><div class="ttname"><a href="classfacebook_1_1logdevice_1_1_async_reader.html#a13331e00d2b9fd60c3d956927dd3cefc">facebook::logdevice::AsyncReader::startReading</a></div><div class="ttdeci">virtual int startReading(logid_t log_id, lsn_t from, lsn_t until=LSN_MAX, const ReadStreamAttributes *attrs=nullptr)=0</div></div>
<div class="ttc" id="classfacebook_1_1logdevice_1_1_async_reader_html_a161d3d09e946c826c7797c25e4bc27a2"><div class="ttname"><a href="classfacebook_1_1logdevice_1_1_async_reader.html#a161d3d09e946c826c7797c25e4bc27a2">facebook::logdevice::AsyncReader::setGapCallback</a></div><div class="ttdeci">virtual void setGapCallback(std::function&lt; bool(const GapRecord &amp;)&gt;)=0</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- HTML footer for doxygen 1.8.14-->
<!-- start footer part -->
<hr class="footer"/><address class="footer">
<small>
LogDevic API v2.35
</small>
</address>
</body>
</html>
